/*
 * img.h
 *
 *  Created on: 05/11/2008
 *      Author: arkanrow
 */

#ifndef IMG_H_
#define IMG_H_

typedef enum formatT {IMG_BMP, IMG_SCREEN} formatT;
typedef enum bltopT {BLT_CPY, BLT_AND, BLT_OR, BLT_XOR} bltopT;

/*2D Point data type*/
typedef struct pointT {
	int x, y;
} pointT;

/*Rectangle data type*/
typedef struct rectT {
	pointT orig;
	unsigned h, w;
} rectT;

/*RGB Color data type*/
typedef struct colorT {
	unsigned char r, g, b;
}colorT;

/*RGB Colored pixel data type*/
typedef struct pixelT {
	pointT point;
	colorT color;
} pixelT;


/*Resolution data type*/
typedef struct{
	int w;
	int h;
}resT;

/*Image data type*/
typedef struct
{
	unsigned w,h,bits;
	char * image;
	formatT format;
} imgT;


/* Loads a BMP file in an imgT image type */
imgT * imgLoad(char * fileName, formatT format);

/* Creates an empty imgT */
imgT * imgCreate(unsigned w, unsigned h); 

 /* Creates an imgT image that abstracts the computer screen */
imgT * imgScreen( int res );

/* Destroys any imgT image*/
void imgFree(imgT * img);

/* Draws a pixel onto an imgT image type */
void setPixel(imgT * img, pixelT p);

/* Obtains a pixel form a position*/
pixelT getPixel(imgT * img, pointT p);

/* Refreshes the screen */
void imgScreenRefresh(imgT * scr);

/* Clears the image */
void imgClear(imgT * img, colorT color);

/*get resolution!*/
int getResolutionCode(imgT *img);

#endif /* IMG_H_ */
